<template>
  <div class="adduser">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="用户名">
        <el-input v-model="form.username"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="form.password" type="password"></el-input>
      </el-form-item>
      <el-form-item label="目标院校">
        <el-input v-model="form.tschool"></el-input>
      </el-form-item>
      <el-form-item label="邮箱">
        <el-input v-model="form.email"></el-input>
      </el-form-item>
      <el-form-item label="QQ号码">
        <el-input v-model="form.qq"></el-input>
      </el-form-item>
      <el-form-item label="手机号">
        <el-input v-model="form.telphone"></el-input>
      </el-form-item>
      <div>
        <el-radio v-model="radio" label="0">男</el-radio>
        <el-radio v-model="radio" label="1">女</el-radio>
      </div>
      <el-button type="primary" @click="onSubmit">提交</el-button>
    </el-form>
  </div>
</template>

<script>
import { usercenterAdd } from "../api/myReq";
export default {
  name: "adduser",
  data() {
    return {
      form: {
        username: "",
        email: "",
        telphone: "",
        password: "",
        qq: "",
        tschool: "",
        sex: this.radio ? "女" : "男"
      },
      radio: "",
    };
  },
  methods: {
    onSubmit() {
      usercenterAdd(this.form).then((resp) => {
        console.log(resp);
        this.$message({
          message: resp.data.message,
          duration: 2000,
          type: "success",
        });
      });
      this.$router.push('/home/userInfo');
    },
    
  },
};
</script>

<style scoped>
.adduser{
  margin: 0 auto;
  width: 1000px;
}
</style>